<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <meta charset="utf-8" />
    <title>{{ADMINNAME}}-{{$title}}</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <meta content="" name="description" />
    <meta name="csrf-token" content="{{ csrf_token() }}">
    @include('adminer.public.style')
    @yield('style')
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="fixed-top">
@include("adminer.public.header")

<!-- BEGIN CONTAINER -->
<div id="container" class="row-fluid">
    <!-- BEGIN SIDEBAR -->
    <div id="sidebar" class="nav-collapse collapse">
        <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
        <div class="sidebar-toggler hidden-phone"></div>
        <!-- BEGIN SIDEBAR TOGGLER BUTTON -->

        <!-- BEGIN RESPONSIVE QUICK SEARCH FORM -->

        <div class="navbar-inverse">
            <form class="navbar-search visible-phone">
                <input type="text" class="search-query" placeholder="Search" />
            </form>
        </div>

        <!-- END RESPONSIVE QUICK SEARCH FORM -->
        <!-- BEGIN SIDEBAR MENU -->
        <ul class="sidebar-menu">
            <li><a class="" href="/manage"><span class="icon-box"><i class="icon-home"></i></span> 主页面</a></li>
            <?=session('menu')?>
        </ul>
        <!-- END SIDEBAR MENU -->
    </div>
    <!-- END SIDEBAR -->
    <!-- BEGIN PAGE -->
    <div id="main-content">
        <!-- BEGIN PAGE CONTAINER-->
        <div class="container-fluid">
            @yield('content')
        </div>
    </div>
</div>
<!-- END CONTAINER -->
<!-- BEGIN COPYRIGHT -->
@include("adminer.public.footer")
<!-- END COPYRIGHT -->
<!-- BEGIN JAVASCRIPTS -->
@include("adminer.public.js")
@yield('script')
<script>
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });

    $(function() {
        // 导航选中

        if($("#main-form").length > 0){
            $("#main-form").Validform({
                btnReset:".btn_reset",
                ajaxPost: true,
                showAllError: false,
                tipSweep: true,
                callback: function (ret) {
                    if(ret.hasOwnProperty('code')){
                        /* 表单验证错误 */
                        if(ret.code == 200){

                            if(ret.hasOwnProperty('redirect') && ret.redirect != 'parent'){

                                layer.msg(ret.message,{time:1500}, function(){
                                    window.location.href = ret.redirect;
                                });

                            }else{
                                layer.msg(ret.message,{time:1500}, function(){
                                    window.location.href = document.referrer;;
                                });
                            }
                            return false;
                        }else{
                            $('#error-tip').html(ret.message);
                            $('#error').show();
                            return false;
                        }

                    }else{
                        $('#error-tip').html('网络请求失败');
                        $('#error').show();
                    }
                    return false;
                },
                tiptype:function(msg,o,cssctl){

                    if(o.type == 3){
                        $('#error-tip').html(msg);
                        $('#error').show();
                    }else{
                        $('#error-tip').html('');
                        $('#error').hide();
                    }
                }
            });
        }

    });

</script>
<script>
    $(".child").each(function(index){
        console.log($.cookie('cms_posi'));
        if($(this).attr('data-info') == $.cookie('cms_posi')){
            $(this).addClass('active');
            $(this).parent().parent().addClass('active');
            $(this).parent().parent().find("span.arrow").addClass('open');
        }
    })
    function childC(data){
        $.cookie('cms_posi', data.attr('data-info'));
    }
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>